#ifndef BASE_DEFINES_H
#define BASE_DEFINES_H

//! 资源释放相关宏
#define CHECK_DELETE_RESET_OBJ(obj) do { if (obj != nullptr) { delete obj; obj = nullptr; } } while (0)
#define CHECK_CLOSE_RESET_FD(fd)    do { if (fd != -1) { close(fd); fd = -1; } } while (0)
#define CHECK_CLOSE_FD(fd)  do { if (fd != -1) { close(fd); } } while (0)

//! 在类中禁用复制特性
#define NONCOPYABLE(class_name) \
    class_name(const class_name&) = delete;     \
    class_name& operator = (const class_name &) = delete

//! 在类中禁用移动特性
#define IMMOVEABLE(class_name)  \
    class_name(class_name &&) = delete; \
    class_name& operator = (class_name &&) = delete

#endif